<?php
namespace app\index\controller;

use app\index\service\MessageService;
use think\Controller;
use think\Request;
use app\index\validate\Login as LoginValidate;

class Message extends Access
{

    public function send_sms(Request $request){
        $tel = $request->post('tel', '','string');
        $validate = $this->validate(['tel'=>$tel],'login.check_tel');
        if($validate !== true){
            return outputJson(4009,$validate);
        }


        try{
            (new MessageService())->send_reg($tel);
        }catch (\Exception $e) {
            return outputJson(4009, $e->getMessage());
        }

        return outputJson(2000,lang('code_2000'));
    }

}
